ksg.ui.widgets.BaseWidget = {
	//--- IWidget
	_IWidget_construct: function() {
		this.editPrivilege = ksg.security.Privileges.None;
		ksg.App.bizProcMgr.registerWidget(this);
	},
	
	_IWidget_destruct: function() {
		ksg.App.bizProcMgr.unregisterWidget(this);
	},
	
	setEditPrivilege: function(privilege) {
		this.editPrivilege = privilege;
	},

	_getTemplateName: function() {
		var templateName = null;		
		//var templateSet = this.options.template;
		var templateSet = this.element.data("template");
		if(templateSet) {
			var editPrivilege = this.editPrivilege;
			var tsType = typeof(templateSet);
			if(tsType == "string")
				templateName = templateSet;
			else if(tsType == "object") {
				if(editPrivilege > ksg.security.Privileges.ReadOnly)
					templateName = templateSet["edit"];
				if(!(templateName) && editPrivilege >= ksg.security.Privileges.ReadOnly)
					templateName = templateSet["readOnly"];
			}
				
		}
		return templateName;
	},
	
	_findClassBeginingWith: function($el, className) {
		var remainingName = null;
		var classAttr = $el.attr('class');
		if(classAttr) {
			var classList = classAttr.split(/\s+/);
			$.each( classList, function(){
				if(this.length >= className.length && this.substr(0,className.length) == className) {
					remainingName = this.substr(className.length);
					return false;
				}				
			});
		}
		
		return remainingName;		
	},
	
	getParentBizProcId: function() {return this.options.bizProcId;}
	
}
